new Vue({
	el: "#app",
	data: {
		imgUrl: "https://app.meijiangzi.com/static/mini_",
		ImgBaseUrl: "https://app.meijiangzi.com/static/",
		arrayBtn: [ {
			id: 1,
			value: "全部"
		}
		// , {
		//     id: 2,
		//     value: "最近7天"
		// }, {
		//     id: 3,
		//     value: "最近30天"
		// }, {
		//     id: 4,
		//     value: "最近3个月"
		// } 
		],
		currentIndex: "",
		pageNum: 1,
		timeType: "",
		list: [],
		isbottom: !1
	},
	methods: {
		checkTime: function(t, e) {
			this.currentIndex = e, this.timeType = t.id, this.pageNum = 1, this.isbottom = !1, 
			this.getData(this.timeType);
		},
		getData: function() {
			var t = this;
			if (this.isbottom) return !1;
			wx.showLoading({
				title: "加载中",
				mask: !0
			}), this.$http.post(baseUrl + "/mjz/userPoints/api/userPointsDetail", {
			  currentPage: this.pageNum,
			  pageSize: 10,
				type: this.timeType
			}).then(function(e) {
				wx.hideLoading();
				var a = e.data;
				if (a.data.forEach(function(t) {
					t.time = t.createTime;
				  t.msg = (t.period ? '[第' + t.period + '期]' : '') + t.remark + ':' + t.points;
				}), !a.success) return wx.hideLoading(), wx.showToast({
					title: a.description,
					icon: "none",
					duration: 2e3,
					mask: !0
				}), !1;
				if (0 == a.data.length && t.pageNum > 1) return wx.showToast({
					title: "已经到最底下了",
					icon: "none",
					duration: 1e3,
					mask: !0
				}), t.isbottom = !0, !1;
				if (a.data.length > 0 && 1 == t.pageNum) t.list = a.data; else {
					var i;
					(i = t.list).push.apply(i, a.data);
				}
				this.isExcute = false;
			}).catch(function(t) {
				wx.hideLoading(), wx.showToast({
					title: "网络错误，请检查网络",
					icon: "none",
					duration: 2e3,
					mask: !0
				});
			});
		},
		pullrefresh: function() {
			this.pageNum++, this.getData(this.pageNum);
		},
		handleScroll: function(){
			// 防止重复
			if (this.isExcute) {
				return;
			}
			if (this.isbottom) {
				return;
			}
			var flag = srollEvent.isReachBottom();
			if (!flag) {
				return;
			}
			this.isExcute = true;
			this.pullrefresh();
		}
	},
	mounted: function() {
		window.addEventListener("scroll", this.handleScroll, {
			passive: false
		});
	},
	created: function(){
		this.currentIndex = "", this.getData();
	}
});